\(\int (a+b \sec (c+d x))^2 \tan ^4(c+d x) \, dx\) [280]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 21, antiderivative size = 116 \[ \int (a+b \sec (c+d x))^2 \tan ^4(c+d x) \, dx=a^2 x+\frac {3 a b \text {arctanh}(\sin (c+d x))}{4 d}-\frac {a^2 \tan (c+d x)}{d}-\frac {3 a b \sec (c+d x) \tan (c+d x)}{4 d}+\frac {a^2 \tan ^3(c+d x)}{3 d}+\frac {a b \sec (c+d x) \tan ^3(c+d x)}{2 d}+\frac {b^2 \tan ^5(c+d x)}{5 d} \]

[Out]

a^2*x+3/4*a*b*arctanh(sin(d*x+c))/d-a^2*tan(d*x+c)/d-3/4*a*b*sec(d*x+c)*tan(d*x+c)/d+1/3*a^2*tan(d*x+c)^3/d+1/
2*a*b*sec(d*x+c)*tan(d*x+c)^3/d+1/5*b^2*tan(d*x+c)^5/d

Rubi [A] (verified)

Time = 0.18 (sec) , antiderivative size = 116, normalized size of antiderivative = 1.00, number of steps used = 10, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3971, 3554, 8, 2691, 3855, 2687, 30} \[ \int (a+b \sec (c+d x))^2 \tan ^4(c+d x) \, dx=\frac {a^2 \tan ^3(c+d x)}{3 d}-\frac {a^2 \tan (c+d x)}{d}+a^2 x+\frac {3 a b \text {arctanh}(\sin (c+d x))}{4 d}+\frac {a b \tan ^3(c+d x) \sec (c+d x)}{2 d}-\frac {3 a b \tan (c+d x) \sec (c+d x)}{4 d}+\frac {b^2 \tan ^5(c+d x)}{5 d} \]

[In]

Int[(a + b*Sec[c + d*x])^2*Tan[c + d*x]^4,x]

[Out]

a^2*x + (3*a*b*ArcTanh[Sin[c + d*x]])/(4*d) - (a^2*Tan[c + d*x])/d - (3*a*b*Sec[c + d*x]*Tan[c + d*x])/(4*d) +
 (a^2*Tan[c + d*x]^3)/(3*d) + (a*b*Sec[c + d*x]*Tan[c + d*x]^3)/(2*d) + (b^2*Tan[c + d*x]^5)/(5*d)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rule 2687

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[1/f, Subst[Int[(b*x)
^n*(1 + x^2)^(m/2 - 1), x], x, Tan[e + f*x]], x] /; FreeQ[{b, e, f, n}, x] && IntegerQ[m/2] &&  !(IntegerQ[(n
- 1)/2] && LtQ[0, n, m - 1])

Rule 2691

Int[((a_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[b*(a*Sec[e +
 f*x])^m*((b*Tan[e + f*x])^(n - 1)/(f*(m + n - 1))), x] - Dist[b^2*((n - 1)/(m + n - 1)), Int[(a*Sec[e + f*x])
^m*(b*Tan[e + f*x])^(n - 2), x], x] /; FreeQ[{a, b, e, f, m}, x] && GtQ[n, 1] && NeQ[m + n - 1, 0] && Integers
Q[2*m, 2*n]

Rule 3554

Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((b*Tan[c + d*x])^(n - 1)/(d*(n - 1))), x] - Dis
t[b^2, Int[(b*Tan[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3971

Int[(cot[(c_.) + (d_.)*(x_)]*(e_.))^(m_)*(csc[(c_.) + (d_.)*(x_)]*(b_.) + (a_))^(n_), x_Symbol] :> Int[ExpandI
ntegrand[(e*Cot[c + d*x])^m, (a + b*Csc[c + d*x])^n, x], x] /; FreeQ[{a, b, c, d, e, m}, x] && IGtQ[n, 0]

Rubi steps \begin{align*} \text {integral}& = \int \left (a^2 \tan ^4(c+d x)+2 a b \sec (c+d x) \tan ^4(c+d x)+b^2 \sec ^2(c+d x) \tan ^4(c+d x)\right ) \, dx \\ & = a^2 \int \tan ^4(c+d x) \, dx+(2 a b) \int \sec (c+d x) \tan ^4(c+d x) \, dx+b^2 \int \sec ^2(c+d x) \tan ^4(c+d x) \, dx \\ & = \frac {a^2 \tan ^3(c+d x)}{3 d}+\frac {a b \sec (c+d x) \tan ^3(c+d x)}{2 d}-a^2 \int \tan ^2(c+d x) \, dx-\frac {1}{2} (3 a b) \int \sec (c+d x) \tan ^2(c+d x) \, dx+\frac {b^2 \text {Subst}\left (\int x^4 \, dx,x,\tan (c+d x)\right )}{d} \\ & = -\frac {a^2 \tan (c+d x)}{d}-\frac {3 a b \sec (c+d x) \tan (c+d x)}{4 d}+\frac {a^2 \tan ^3(c+d x)}{3 d}+\frac {a b \sec (c+d x) \tan ^3(c+d x)}{2 d}+\frac {b^2 \tan ^5(c+d x)}{5 d}+a^2 \int 1 \, dx+\frac {1}{4} (3 a b) \int \sec (c+d x) \, dx \\ & = a^2 x+\frac {3 a b \text {arctanh}(\sin (c+d x))}{4 d}-\frac {a^2 \tan (c+d x)}{d}-\frac {3 a b \sec (c+d x) \tan (c+d x)}{4 d}+\frac {a^2 \tan ^3(c+d x)}{3 d}+\frac {a b \sec (c+d x) \tan ^3(c+d x)}{2 d}+\frac {b^2 \tan ^5(c+d x)}{5 d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.62 (sec) , antiderivative size = 107, normalized size of antiderivative = 0.92 \[ \int (a+b \sec (c+d x))^2 \tan ^4(c+d x) \, dx=\frac {60 a^2 \arctan (\tan (c+d x))+45 a b \text {arctanh}(\sin (c+d x))+\tan (c+d x) \left (-90 a b \sec ^3(c+d x)+15 a b \sec (c+d x) \left (3+8 \tan ^2(c+d x)\right )+4 \left (-15 a^2+5 a^2 \tan ^2(c+d x)+3 b^2 \tan ^4(c+d x)\right )\right )}{60 d} \]

[In]

Integrate[(a + b*Sec[c + d*x])^2*Tan[c + d*x]^4,x]

[Out]

(60*a^2*ArcTan[Tan[c + d*x]] + 45*a*b*ArcTanh[Sin[c + d*x]] + Tan[c + d*x]*(-90*a*b*Sec[c + d*x]^3 + 15*a*b*Se
c[c + d*x]*(3 + 8*Tan[c + d*x]^2) + 4*(-15*a^2 + 5*a^2*Tan[c + d*x]^2 + 3*b^2*Tan[c + d*x]^4)))/(60*d)

Maple [A] (verified)

Time = 2.36 (sec) , antiderivative size = 129, normalized size of antiderivative = 1.11

method result size
derivativedivides \(\frac {a^{2} \left (\frac {\tan \left (d x +c \right )^{3}}{3}-\tan \left (d x +c \right )+d x +c \right )+2 a b \left (\frac {\sin \left (d x +c \right )^{5}}{4 \cos \left (d x +c \right )^{4}}-\frac {\sin \left (d x +c \right )^{5}}{8 \cos \left (d x +c \right )^{2}}-\frac {\sin \left (d x +c \right )^{3}}{8}-\frac {3 \sin \left (d x +c \right )}{8}+\frac {3 \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{8}\right )+\frac {b^{2} \sin \left (d x +c \right )^{5}}{5 \cos \left (d x +c \right )^{5}}}{d}\) \(129\)
default \(\frac {a^{2} \left (\frac {\tan \left (d x +c \right )^{3}}{3}-\tan \left (d x +c \right )+d x +c \right )+2 a b \left (\frac {\sin \left (d x +c \right )^{5}}{4 \cos \left (d x +c \right )^{4}}-\frac {\sin \left (d x +c \right )^{5}}{8 \cos \left (d x +c \right )^{2}}-\frac {\sin \left (d x +c \right )^{3}}{8}-\frac {3 \sin \left (d x +c \right )}{8}+\frac {3 \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{8}\right )+\frac {b^{2} \sin \left (d x +c \right )^{5}}{5 \cos \left (d x +c \right )^{5}}}{d}\) \(129\)
parts \(\frac {a^{2} \left (\frac {\tan \left (d x +c \right )^{3}}{3}-\tan \left (d x +c \right )+\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}+\frac {b^{2} \tan \left (d x +c \right )^{5}}{5 d}+\frac {2 a b \left (\frac {\sin \left (d x +c \right )^{5}}{4 \cos \left (d x +c \right )^{4}}-\frac {\sin \left (d x +c \right )^{5}}{8 \cos \left (d x +c \right )^{2}}-\frac {\sin \left (d x +c \right )^{3}}{8}-\frac {3 \sin \left (d x +c \right )}{8}+\frac {3 \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{8}\right )}{d}\) \(129\)
risch \(a^{2} x +\frac {i \left (75 a b \,{\mathrm e}^{9 i \left (d x +c \right )}-120 a^{2} {\mathrm e}^{8 i \left (d x +c \right )}+60 b^{2} {\mathrm e}^{8 i \left (d x +c \right )}+30 a b \,{\mathrm e}^{7 i \left (d x +c \right )}-360 a^{2} {\mathrm e}^{6 i \left (d x +c \right )}-440 a^{2} {\mathrm e}^{4 i \left (d x +c \right )}+120 b^{2} {\mathrm e}^{4 i \left (d x +c \right )}-30 a b \,{\mathrm e}^{3 i \left (d x +c \right )}-280 a^{2} {\mathrm e}^{2 i \left (d x +c \right )}-75 a b \,{\mathrm e}^{i \left (d x +c \right )}-80 a^{2}+12 b^{2}\right )}{30 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{5}}+\frac {3 a b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{4 d}-\frac {3 a b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{4 d}\) \(213\)

[In]

int((a+b*sec(d*x+c))^2*tan(d*x+c)^4,x,method=_RETURNVERBOSE)

[Out]

1/d*(a^2*(1/3*tan(d*x+c)^3-tan(d*x+c)+d*x+c)+2*a*b*(1/4*sin(d*x+c)^5/cos(d*x+c)^4-1/8*sin(d*x+c)^5/cos(d*x+c)^
2-1/8*sin(d*x+c)^3-3/8*sin(d*x+c)+3/8*ln(sec(d*x+c)+tan(d*x+c)))+1/5*b^2*sin(d*x+c)^5/cos(d*x+c)^5)

Fricas [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 151, normalized size of antiderivative = 1.30 \[ \int (a+b \sec (c+d x))^2 \tan ^4(c+d x) \, dx=\frac {120 \, a^{2} d x \cos \left (d x + c\right )^{5} + 45 \, a b \cos \left (d x + c\right )^{5} \log \left (\sin \left (d x + c\right ) + 1\right ) - 45 \, a b \cos \left (d x + c\right )^{5} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (75 \, a b \cos \left (d x + c\right )^{3} + 4 \, {\left (20 \, a^{2} - 3 \, b^{2}\right )} \cos \left (d x + c\right )^{4} - 30 \, a b \cos \left (d x + c\right ) - 4 \, {\left (5 \, a^{2} - 6 \, b^{2}\right )} \cos \left (d x + c\right )^{2} - 12 \, b^{2}\right )} \sin \left (d x + c\right )}{120 \, d \cos \left (d x + c\right )^{5}} \]

[In]

integrate((a+b*sec(d*x+c))^2*tan(d*x+c)^4,x, algorithm="fricas")

[Out]

1/120*(120*a^2*d*x*cos(d*x + c)^5 + 45*a*b*cos(d*x + c)^5*log(sin(d*x + c) + 1) - 45*a*b*cos(d*x + c)^5*log(-s
in(d*x + c) + 1) - 2*(75*a*b*cos(d*x + c)^3 + 4*(20*a^2 - 3*b^2)*cos(d*x + c)^4 - 30*a*b*cos(d*x + c) - 4*(5*a
^2 - 6*b^2)*cos(d*x + c)^2 - 12*b^2)*sin(d*x + c))/(d*cos(d*x + c)^5)

Sympy [F]

\[ \int (a+b \sec (c+d x))^2 \tan ^4(c+d x) \, dx=\int \left (a + b \sec {\left (c + d x \right )}\right )^{2} \tan ^{4}{\left (c + d x \right )}\, dx \]

[In]

integrate((a+b*sec(d*x+c))**2*tan(d*x+c)**4,x)

[Out]

Integral((a + b*sec(c + d*x))**2*tan(c + d*x)**4, x)

Maxima [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 118, normalized size of antiderivative = 1.02 \[ \int (a+b \sec (c+d x))^2 \tan ^4(c+d x) \, dx=\frac {24 \, b^{2} \tan \left (d x + c\right )^{5} + 40 \, {\left (\tan \left (d x + c\right )^{3} + 3 \, d x + 3 \, c - 3 \, \tan \left (d x + c\right )\right )} a^{2} + 15 \, a b {\left (\frac {2 \, {\left (5 \, \sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )}}{\sin \left (d x + c\right )^{4} - 2 \, \sin \left (d x + c\right )^{2} + 1} + 3 \, \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, \log \left (\sin \left (d x + c\right ) - 1\right )\right )}}{120 \, d} \]

[In]

integrate((a+b*sec(d*x+c))^2*tan(d*x+c)^4,x, algorithm="maxima")

[Out]

1/120*(24*b^2*tan(d*x + c)^5 + 40*(tan(d*x + c)^3 + 3*d*x + 3*c - 3*tan(d*x + c))*a^2 + 15*a*b*(2*(5*sin(d*x +
 c)^3 - 3*sin(d*x + c))/(sin(d*x + c)^4 - 2*sin(d*x + c)^2 + 1) + 3*log(sin(d*x + c) + 1) - 3*log(sin(d*x + c)
 - 1)))/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 220 vs. \(2 (106) = 212\).

Time = 1.04 (sec) , antiderivative size = 220, normalized size of antiderivative = 1.90 \[ \int (a+b \sec (c+d x))^2 \tan ^4(c+d x) \, dx=\frac {60 \, {\left (d x + c\right )} a^{2} + 45 \, a b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 45 \, a b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) + \frac {2 \, {\left (60 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{9} - 45 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{9} - 320 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} + 210 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} + 520 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 192 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 320 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 210 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 60 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 45 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{5}}}{60 \, d} \]

[In]

integrate((a+b*sec(d*x+c))^2*tan(d*x+c)^4,x, algorithm="giac")

[Out]

1/60*(60*(d*x + c)*a^2 + 45*a*b*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - 45*a*b*log(abs(tan(1/2*d*x + 1/2*c) - 1))
 + 2*(60*a^2*tan(1/2*d*x + 1/2*c)^9 - 45*a*b*tan(1/2*d*x + 1/2*c)^9 - 320*a^2*tan(1/2*d*x + 1/2*c)^7 + 210*a*b
*tan(1/2*d*x + 1/2*c)^7 + 520*a^2*tan(1/2*d*x + 1/2*c)^5 - 192*b^2*tan(1/2*d*x + 1/2*c)^5 - 320*a^2*tan(1/2*d*
x + 1/2*c)^3 - 210*a*b*tan(1/2*d*x + 1/2*c)^3 + 60*a^2*tan(1/2*d*x + 1/2*c) + 45*a*b*tan(1/2*d*x + 1/2*c))/(ta
n(1/2*d*x + 1/2*c)^2 - 1)^5)/d

Mupad [B] (verification not implemented)

Time = 15.41 (sec) , antiderivative size = 332, normalized size of antiderivative = 2.86 \[ \int (a+b \sec (c+d x))^2 \tan ^4(c+d x) \, dx=\frac {\left (2\,a^2-\frac {3\,a\,b}{2}\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^9+\left (7\,a\,b-\frac {32\,a^2}{3}\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^7+\left (\frac {52\,a^2}{3}-\frac {32\,b^2}{5}\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+\left (-\frac {32\,a^2}{3}-7\,b\,a\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+\left (2\,a^2+\frac {3\,b\,a}{2}\right )\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^{10}-5\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^8+10\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6-10\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4+5\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-1\right )}+\frac {2\,a^2\,\mathrm {atan}\left (\frac {64\,a^6\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{64\,a^6+36\,a^4\,b^2}+\frac {36\,a^4\,b^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{64\,a^6+36\,a^4\,b^2}\right )}{d}+\frac {3\,a\,b\,\mathrm {atanh}\left (\frac {48\,a^5\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{48\,a^5\,b+27\,a^3\,b^3}+\frac {27\,a^3\,b^3\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{48\,a^5\,b+27\,a^3\,b^3}\right )}{2\,d} \]

[In]

int(tan(c + d*x)^4*(a + b/cos(c + d*x))^2,x)

[Out]

(tan(c/2 + (d*x)/2)^5*((52*a^2)/3 - (32*b^2)/5) - tan(c/2 + (d*x)/2)^9*((3*a*b)/2 - 2*a^2) - tan(c/2 + (d*x)/2
)^3*(7*a*b + (32*a^2)/3) + tan(c/2 + (d*x)/2)^7*(7*a*b - (32*a^2)/3) + tan(c/2 + (d*x)/2)*((3*a*b)/2 + 2*a^2))
/(d*(5*tan(c/2 + (d*x)/2)^2 - 10*tan(c/2 + (d*x)/2)^4 + 10*tan(c/2 + (d*x)/2)^6 - 5*tan(c/2 + (d*x)/2)^8 + tan
(c/2 + (d*x)/2)^10 - 1)) + (2*a^2*atan((64*a^6*tan(c/2 + (d*x)/2))/(64*a^6 + 36*a^4*b^2) + (36*a^4*b^2*tan(c/2
 + (d*x)/2))/(64*a^6 + 36*a^4*b^2)))/d + (3*a*b*atanh((48*a^5*b*tan(c/2 + (d*x)/2))/(48*a^5*b + 27*a^3*b^3) +
(27*a^3*b^3*tan(c/2 + (d*x)/2))/(48*a^5*b + 27*a^3*b^3)))/(2*d)